<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function addattribute()
{
	$('#addattributeform').modal('show');	
}
function edit(id,t)
{
$.post("/product/ajaxbutton", {"op": "edit","id":id,"st":t},
  function(data){
		if(data)
		{
			
			$("#name").val(data.cate_name);
			$("#en_name").val(data.en_name);
			$("#sort_id").val(data.sort_id);
			$("#sort").val(data.sort);
			$("#id").val(data.id);
			$("#sku_code").val(data.sku_code);
			$('#addattributeform').modal('show');
		}
		
	return;
   },"json");	
}
</script>
<title>商品分类</title>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">商品分类</h1>
      <span class="pagedesc">
      <div class="menulist">
        <ul class="profile_summary">
          <li> <a href="javascript:void(0)" onClick="addattribute()" class=""><span>添加商品分类</span></a></li>
        </ul>
      </div>
      </span>
      <div class="menulist">
        <ul class="profile_summary">
          <li class="current"></li>
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
        <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          <thead>
            <tr>
              <th class="head1">名称</th>
              <th class="head1">商品名</th>
            </tr>
          </thead>
          <tbody>
          
          {{foreach from=$menudblist item=res key=key}}
          <tr>
            <td class="head1">{{$res.cate_name}}</td>
            <td class="head0"><a href="javascript:void(0)" onClick="edit({{$res.id}},'editcategory')">编辑</a>｜<a href="javascript:void(0)" onClick="delone({{$res.id}},'delcategory')">移除</a></td>
          </tr>
          {{if $res.rankdates}}
          {{foreach from=$res.rankdates key=key item=o}}
          <tr>
            <td class="head1">{{$o.rankimg}}{{$o.cate_name}}</td>
            <td class="head0"><a href="javascript:void(0)" onClick="edit({{$o.id}},'editcategory')">编辑</a>｜<a href="javascript:void(0)" onClick="delone({{$o.id}},'delcategory')">移除</a></td>
          </tr>
          {{if $o.rankthree}}
          
          {{foreach from=$o.rankthree key=key item=li}}
          <tr>
            <td class="head1">{{$li.rankimg}}{{$li.cate_name}}</td>
            <td class="head0"><a href="javascript:void(0)" onClick="edit({{$li.id}},'editcategory')">编辑</a>｜<a href="javascript:void(0)" onClick="delone({{$li.id}},'delcategory')">移除</a></td>
          </tr>
          {{/foreach}}
          {{/if}}
          {{/foreach}}
          {{/if}}
          {{/foreach}}
            </tbody>
          
        </table>
        <br />
      </div>
      <!--subcontent--> 
      
      <!--subcontent--> 
      
    </div>
    <!--contentwrapper--> 
    
  </div>
  <!-- centercontent --> 
  
</div>

<!-- 模态框（Modal）添加商品属性 -->
<form action="/product/ajaxbutton?op=savecategory"  method="post" name="attributeform" id="attributeform" >
<input type="hidden" id="id" name="id" value="0">
  <div class="modal fade" id="addattributeform" tabindex="-1" role="dialog" aria-labelledby="returnaddattributeform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnaddattributeform"> 添加商品分类 </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>名称： </td>
              <td align="left"><input type="text" name="name" id="name" required class="width200"  placeholder="商品分类名称" /></td>
            </tr>
            <tr>
              <td>英文名称： </td>
              <td align="left"><input type="text" name="en_name" id="en_name" required class="width200"  placeholder="商品分类英文名称" /></td>
            </tr>
            <tr>
              <td>分类所属： </td>
              <td align="left"><select name="sort_id" id="sort_id">
                  <option value="">Choose One</option>
                  <option value="0">一级目录</option>
                  
                                {{foreach from=$menudblist item=res key=key}}
                                
                  <option value="{{$res.id}}">{{$res.rankimg}}{{$res.cate_name}}</option>
                  
                                	{{if $res.rankdates}}
										 {{foreach from=$res.rankdates key=key item=o}}
										 	
                  <option value="{{$o.id}}">{{$o.rankimg}}{{$o.cate_name}}</option>
                  
                                            {{if $o.rankthree}}
                                                 {{foreach from=$o.rankthree key=key item=li}}
                                                    
                  <option value="{{$li.id}}">{{$li.rankimg}}{{$li.cate_name}}</option>
                  
                                                 {{/foreach}}
											 {{/if}}
										 {{/foreach}}
									 {{/if}}
                                {{/foreach}}
                                
                            
                </select></td>
            </tr>
            <tr>
              <td>自建SKU标识： </td>
              <td align="left"><input type="text" name="sku_code" id="sku_code" class="width50" /></td>
            </tr>
            <tr>
              <td>排序： </td>
              <td align="left"><input type="text" name="sort" id="sort" class="width50" placeholder="倒序" /></td>
            </tr>
            <!--  <tr>
              <td>标签： </td>
              <td align="left"><input type="text" name="sort" id="sort" class="width300" placeholder="系统设置使用分类标签自建货号时启用" /></td>
            </tr>-->
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmit('attributeform','addattributeform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
</form>
</body>
</html>